home *** CD-ROM | disk | FTP | other *** search
-
- #include "testgen.h"
- #include "invoice.h"
-
- void r1_bottom(int vals[], Item& someItem,int numItems,Invoice& theInvoice,Client& someClient)
- {
- cout << "TESTING CLIENTS & NO. OF ITEMS\n";
- cout << "client: " << someClient << "\n";
- cout << "items are:\n";
- for (int i = 0; i < numItems; i++) {
- theInvoice.addItem(&someItem);
- cout << " " << someItem << "\n";
- }
- cout << "total discount: "
- << theInvoice.totalDiscount() << "\n";
- }
-
- void r1_someItem(int vals[], int numItems,Invoice& theInvoice,Client& someClient){
- Item someItem[] = {
- Item(100, 10, 1.00),
- Item(1100, 5, 5.00)};
- r1_bottom(vals,someItem[vals[3]],numItems,theInvoice,someClient);
-
- }
-
- void r1_numItems(int vals[], Invoice& theInvoice,Client& someClient){
- int numItems[] = {
- 1,
- 0,
- 4};
- r1_someItem(vals,numItems[vals[2]],theInvoice,someClient);
-
- }
-
- void r1_theInvoice(int vals[], Client& someClient){
- Invoice theInvoice[] = {
- Invoice(&someClient)};
- r1_numItems(vals,theInvoice[vals[1]],someClient);
-
- }
-
- void r1_someClient(int vals[]){
- Client someClient[] = {
- Client(RETAIL),
- Client(WHOLESALE),
- Client(FOREIGN)};
- r1_theInvoice(vals,someClient[vals[0]]);
-
- }
-
- void r2_bottom(int vals[], Item& otherItem,Item& someItem,Invoice& theInvoice,Client& someClient)
- {
- cout << "TESTING MIXING ITEMS\n";
- cout << "client: " << someClient << "\n";
- cout << "items are:\n";
- theInvoice.addItem(&someItem);
- cout << " " << someItem << "\n";
- theInvoice.addItem(&otherItem);
- cout << " " << otherItem << "\n";
- cout << "total discount: "
- << theInvoice.totalDiscount() << "\n";
- }
-
- void r2_otherItem(int vals[], Item& someItem,Invoice& theInvoice,Client& someClient){
- Item otherItem[] = {
- Item(100, 10, 1.00),
- Item(1100, 5, 5.00)};
- r2_bottom(vals,otherItem[vals[3]],someItem,theInvoice,someClient);
-
- }
-
- void r2_someItem(int vals[], Invoice& theInvoice,Client& someClient){
- Item someItem[] = {
- Item(100, 10, 1.00),
- Item(1100, 5, 5.00)};
- r2_otherItem(vals,someItem[vals[2]],theInvoice,someClient);
-
- }
-
- void r2_theInvoice(int vals[], Client& someClient){
- Invoice theInvoice[] = {
- Invoice(&someClient)};
- r2_someItem(vals,theInvoice[vals[1]],someClient);
-
- }
-
- void r2_someClient(int vals[]){
- Client someClient[] = {
- Client(RETAIL),
- Client(WHOLESALE),
- Client(FOREIGN)};
- r2_theInvoice(vals,someClient[vals[0]]);
-
- }
-
- void main() {
- int nvals_r1[4] = { 3,1,3,2 };
- Test_gen_combining g_r1(4, nvals_r1);
- int vals_r1[4] = { -1 };
- int nvals_r2[4] = { 3,1,2,2 };
- Test_gen_combining g_r2(4, nvals_r2);
- int vals_r2[4] = { -1 };
- while (g_r1.next_vector(vals_r1) == YES) {
- r1_someClient(vals_r1);
- };
- while (g_r2.next_vector(vals_r2) == YES) {
- r2_someClient(vals_r2);
- };
- }
-